﻿using System;
using System.Collections.Generic;
using SharpSqlAnalyzer.nodes;
using SharpSqlAnalyzer.nodes.mdx;

namespace SharpSqlAnalyzer.stmt.mdx
{
	// Token: 0x020001A4 RID: 420
	public class TMdxScope : TCustomSqlStatement
	{
		// Token: 0x06000E3A RID: 3642 RVA: 0x00309A8E File Offset: 0x00307C8E
		public TMdxScope(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sstmdxscope;
		}

		// Token: 0x06000E3B RID: 3643 RVA: 0x00309AB0 File Offset: 0x00307CB0
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			if (this.rootNode == null)
			{
				return -1;
			}
			base.doParseStatement(psql);
			this.scopeNode = (TMdxScopeNode)this.rootNode;
			if (this.scopeNode.StatementList == null)
			{
				return 0;
			}
			for (int i = 0; i < this.scopeNode.StatementList.Count; i++)
			{
				if (this.scopeNode.StatementList[i] is TMdxExpNode)
				{
					TMdxExpression tmdxExpression = new TMdxExpression(EDbVendor.dbvmdx);
					tmdxExpression.rootNode = this.scopeNode.StatementList[i];
					tmdxExpression.doParseStatement(this);
					this.statementList.add(tmdxExpression);
				}
				else if (this.scopeNode.StatementList[i] is TMdxSelectNode)
				{
					TMdxSelect tmdxSelect = new TMdxSelect(EDbVendor.dbvmdx);
					tmdxSelect.rootNode = this.scopeNode.StatementList[i];
					tmdxSelect.doParseStatement(this);
					this.statementList.add(tmdxSelect);
				}
				else if (this.scopeNode.StatementList[i] is TMdxScopeNode)
				{
					TMdxScope tmdxScope = new TMdxScope(EDbVendor.dbvmdx);
					tmdxScope.rootNode = this.scopeNode.StatementList[i];
					tmdxScope.doParseStatement(this);
					this.statementList.add(tmdxScope);
				}
			}
			return 0;
		}

		// Token: 0x06000E3C RID: 3644 RVA: 0x00309BF9 File Offset: 0x00307DF9
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000E3D RID: 3645 RVA: 0x00309C0C File Offset: 0x00307E0C
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			foreach (TMdxExpNode tmdxExpNode in this.ExprList)
			{
				tmdxExpNode.acceptChildren(v);
			}
			this.StatementList.acceptChildren(v);
			v.postVisit(this);
		}

		// Token: 0x17000294 RID: 660
		// (get) Token: 0x06000E3E RID: 3646 RVA: 0x00309C78 File Offset: 0x00307E78
		public virtual List<TMdxExpNode> ExprList
		{
			get
			{
				return this.scopeNode.ExprList;
			}
		}

		// Token: 0x17000295 RID: 661
		// (get) Token: 0x06000E3F RID: 3647 RVA: 0x00309C85 File Offset: 0x00307E85
		public virtual TStatementList StatementList
		{
			get
			{
				return this.statementList;
			}
		}

		// Token: 0x0400132A RID: 4906
		private TMdxScopeNode scopeNode;

		// Token: 0x0400132B RID: 4907
		private TStatementList statementList = new TStatementList();
	}
}
